/**
 * @dirctive is-blur
 * 用来决定是否聚焦
 */
export default {
    twoWay: true,
    bind: function(){
        this.onfocus = function(){
            this.set(true);

        }.bind(this);
        this.el.addEventListener('focus', this.onfocus);

        this.onblur = function(){
            this.set(false);

        }.bind(this);
        this.el.addEventListener('blur', this.onblur);
    },
    update: function(value){
        if(value===true){
            this.el.focus();
            this.el.select();
        }else{
            this.el.blur();
        }
    },
    unbind: function(){
        this.el.removeEventListener('focus', this.onfocus);
        this.el.removeEventListener('blur', this.onblur);
    }
}
